package h.c.z.designPattern.B01_Strategy;

/**
 * 说明：满减
 * @author jinsicao
 * @version 2016年12月17日
 */
public class ReturnStrategy implements Strategy {
	
	/**
	 * 满额
	 */
	private double moneyCondition;
	
	/**
	 * 优惠额度
	 */
	private double moneyReturn;
	
	public ReturnStrategy(double moneyCondition, double moneyReturn) {
		this.moneyCondition = moneyCondition;
		this.moneyReturn = moneyReturn;
	}

	@Override
	public double calculatePrice(double goodsPrice, int quantity) {
		double totalPrice = goodsPrice * quantity;
		if (totalPrice >= this.moneyCondition) {
			totalPrice -= this.moneyReturn;
		}
		return totalPrice;
	}
}
